﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="database.DAO, golf.Room"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>방선택</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
	function go_URL(url)
	{
        location.href = url;
	}
//-->
</SCRIPT>
</head>

<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<h1>방 선택</h1>
<%
DAO dao = DAO.getInstance();
Room[] rooms = dao.getRoomList((Integer)session.getAttribute("channelNo"));
if( rooms != null ){%>
<table border="1" cellspacing="0" bordercolordark="white" bordercolorlight="black" width="80%">
    <tr>
        <td width="30"><span style="font-size:9pt;">방번호</span></td>
        <td width="250"><span style="font-size:9pt;">방이름</span></td>
        <td width="50"><span style="font-size:9pt;">현재캐릭터수</span></td>
        <td width="50"><span style="font-size:9pt;">제한인원</span></td>
        <td width="50"><span style="font-size:9pt;">제한레벨</span></td>
        <td width="30"><span style="font-size:9pt;">방 형식</span></td>
        <td width="80"><span style="font-size:9pt;">게임타입</span></td>
        <td width="30"><span style="font-size:9pt;">진행</span></td>
        <td width="80"><span style="font-size:9pt;">코스</span></td>
        <td width="30"><span style="font-size:9pt;">홀수</span></td>
        <td width="80"><span style="font-size:9pt;">판돈</span></td>
    </tr>
	<%for(int i = 0; i < rooms.length; i++){ %>
    <tr>
        <!-- 방번호 --><td width="30"><span style="font-size:9pt;"><%=rooms[i].getNo() %></span></td>
        <!-- 방이름 --><td width="250"><span style="font-size:9pt;"><%=rooms[i].getName() %></span></td>
        <!-- 현재캐릭터수 --><td width="50"><span style="font-size:9pt;"><%=rooms[i].getNow_person_no() %></span></td>
        <!-- 제한인원 --><td width="50"><span style="font-size:9pt;"><%=rooms[i].getLimit_person_no() %></span></td>
        <!-- 제한레벨 --><td width="50"><span style="font-size:9pt;"><%=rooms[i].getLimit_level() %></span></td>
        <!--방 형식--><td width="30"><span style="font-size:9pt;"><%=rooms[i].getRoomType() %></span></td>
        <!--게임 타입--><td width="80"><span style="font-size:9pt;"><%if(rooms[i].getGame()!=null) out.println(rooms[i].getGame().getGame_type());%>&nbsp;</span></td>
        <!--진행여부--><td width="30"><span style="font-size:9pt;"><%if(rooms[i].getGame()!=null) out.println(rooms[i].getGame().getPlayYN());%>&nbsp;</span></td>
        <!--코스--><td width="80"><span style="font-size:9pt;"><%if(rooms[i].getGame()!=null) out.println(rooms[i].getGame().getCourse().getName());%>&nbsp;</span></td>
        <!--홀수--><td width="30"><span style="font-size:9pt;"><%if(rooms[i].getGame()!=null) out.println(rooms[i].getGame().getHole_cnt());%>&nbsp;</span></td>
        <!--판돈--><td width="80"><span style="font-size:9pt;"><%if(rooms[i].getGame()!=null) out.println(rooms[i].getGame().getEnzi());%>&nbsp;</span></td>
    </tr>
    <%}%>    
</table>
<%} %>

<form name="form1" method="post" action="../post/postSelectRoom.jsp">
    <table cellpadding="0" cellspacing="0">
        <tr>
            <td width="118">
                <p><span style="font-size:9pt;">방번호</span>
            </td>
            <td width="113">
               <span style="font-size:9pt;"><input type="text" name="roomNumber" maxlength="5" size="5"></span>
            </td>
        </tr>
        <tr>
            <td width="118">
                <span style="font-size:9pt;">비밀번호</span>
            </td>
            <td width="113">
               <span style="font-size:9pt;"><input type="password" name="pw" maxlength="5" size="5"></span>
            </td>
        </tr>
        <tr>
            <td width="118">
                <p><span style="font-size:9pt;"><input type="submit" name="action" value="들어가기"></span></p>
            </td>
            <td width="113"><span style="font-size:9pt;"><input type="button" value="게임방 만들기" onclick='go_URL("createGame.jsp"); return false;'></span></td>
        </tr>
    </table>
</form>
</body>

</html>